# coding: utf8

# coding: utf8
import os
cwd = os.getcwd()
format=MARKMIN
plugin_name = PLUGIN_NAME


def index():
    return dict(message="hello from plugin_plugin.py function index")
    
def aaa():
    return dict(message="hello from plugin_plugin.py function index")    

def test(): return plugin_flatpage()

def display_static():
    """
    Displays app_name/plugin_name/static/
    """
    file_name=request.args(0) or redirect(URL('index'))    
    file_path = os.path.join(cwd,'applications',request.application, 'static', plugin_name, file_name)
    if os.path.exists(file_path):
        content=open(file_path,'r').read()
        body = MARKMIN(content)
    else:
        body = MARKMIN('file not found')
    return dict(body=body)

    
def universal_cake():
    """
    Displays app_name/plugin_name/static/UNIVERSAL_CAKE
    """
    universal_cake_path = os.path.join(cwd,'applications',request.application, 'static', plugin_name,'UNIVERSAL_CAKE')
    universal_cake_body=open(universal_cake_path,'r').read()
    body = MARKMIN(universal_cake_body)
    return dict(body=body)

def voice_of_access():
    """
    Displays app_name/plugin_name/static/VOICE_OF_ACCESS
    """
    voice_of_access_path = os.path.join(cwd,'applications',request.application, 'static', plugin_name, 'VOICE_OF_ACCESS')
    voice_of_access_body=open(voice_of_access_path,'r').read()
    body = MARKMIN(voice_of_access_body)
    return dict(body=body)
